home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / tcega.arc / EGA.DOC < prev    next >
Text File  |  1986-04-14  |  49KB  |  1,551 lines

  1.  
  2.                                                         DATE:   02/25/86
  3.                                                         SYSTEM: KC-TPEGA
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.               Graphics for the IBM's Enhance Graphic Adapter (EGA)
  20.  
  21.  
  22.                               Version 02/25/86
  23.  
  24.  
  25.                            for Microsoft C 3.00+
  26.  
  27.                                    and
  28.  
  29.                             Turbo Pascal 3.01A+
  30.  
  31.  
  32.                                                         DATE:   02/03/86
  33.                                                         SYSTEM: KC-TPEGA
  34.  
  35.  
  36.  
  37.                                  IMPORTANT NOTICE
  38.  
  39.  
  40.         The Enhanced Graphic Adapter (EGA) graphic routines for Microsoft
  41.         3.0 and Turbo Pascal 3.01A was written and is maintained by:
  42.  
  43.                                Kent Cedola
  44.                                2015 Meadow Lake Court
  45.                                Norfolk, Virginia  23518
  46.                                1-(804)-857-0613
  47.  
  48.         Users of this software are encouraged to copy and distribute the
  49.         graphics library and demonstrations programs which are a part of
  50.         this package for non-commericial purposes.
  51.  
  52.         No fee or other charges may be made in the distribution of these
  53.         programs without the written permission from Kent Cedola.
  54.  
  55.         Any program written with this graphic library may be sold, as
  56.         long as the source code for the graphic library in not included.
  57.         If you wish to include the graphic library with the product,
  58.         please contact me for more information and written permission.
  59.  
  60.         The date of release will be used in instead of a version.  When
  61.         requesting information, please included the date (version) of the
  62.         copy that you have and the amount of EGA memory.  Write the above
  63.         for the current release of the graphic library.
  64.  
  65.         If you are satified with the EGA support for Turbo Pascal you are
  66.         asked to send a donation of $20.00 dollars.  All registered users
  67.         will be informed of any major improvements and/or programs
  68.         developments.
  69.  
  70.                                 FREE COPY OF TPEGA
  71.  
  72.         If you send a diskette with a SASE, I will send you the current
  73.         copy of the library and programs for FREE! (360k or 1.2meg disk)
  74.  
  75.  
  76.                                                         DATE:   02/03/86
  77.                                                         SYSTEM: KC-TPEGA
  78.  
  79.  
  80.  
  81.                                       GENERAL
  82.  
  83.  
  84.         This graphic software was written to provide the general public
  85.         a means for writing graphic program for the EGA without any run-
  86.         time fee!  The software is also design to give the programmer
  87.         the most flexibility, so most graphic routines can be changed or
  88.         deleted (saving space) from the final product.
  89.  
  90.         Those with the standard EGA (only 64k of memory) may have some
  91.         problems with some of the graphic primitives as I have a 128k+
  92.         EGA.  I highly recommend adding extra memory to your EGA if
  93.         you plan to do alot of graphic programming.
  94.  
  95.  
  96.                                                         DATE:   02/03/86
  97.                                                         SYSTEM: KC-TPEGA
  98.  
  99.  
  100.                                 SPECIAL NOTICE
  101.  
  102.  
  103.         While trying to get as many graphic routines as possible in this
  104.         release I had to cut corners on the GPSHADE, GPFILL and GPFLOOD
  105.         graphic primitives.  The GPFILL should be used for simple objects
  106.         to be filled in and GPFLOOD for complex objects. Currently, GPFILL
  107.         calls GPFLOOD to do the fill, this will change in the future as I
  108.         will write a version of GPFILL that will execute two or three times
  109.         faster than GPFLOOD (GPFILL = Simple objects only).  GPSHADING has
  110.         a restriction for dimensions of 1,2,4 or 8 or both width and height.
  111.         Other dimensions can be used, but funny fills may happen (will be
  112.         fixed later).  The GPFLOOD routine is fast, and will fill in any
  113.         area no matter how complex (more complex more stack space), but I
  114.         will re-write it for higher speeds.
  115.  
  116.         Both the GPBOX and GPBALL primitives only do solid colors and not
  117.         shades.  Both use special EGA full byte fill modes and are fast.
  118.         BPBOX and GPBALL do NOT set the clipping flag. (Later)
  119.  
  120.         These primitives do work, but they can be better.  I will improve
  121.         the flexibility and speed of these routines in the future.
  122.  
  123.         The following routines miss this release (are in the documentation)
  124.         will be included in a future release.
  125.  
  126.                         GPSCROLL
  127.                         GPPOLY
  128.  
  129.  
  130.                                                         DATE:   02/03/86
  131.                                                         SYSTEM: KC-TPEGA
  132.  
  133.  
  134.                         List of Graphic Functions
  135.  
  136.  
  137.          Graphics Routines               Description
  138.         ----------------------------    ---------------------------------
  139.          GPPARMS;                        Setup graphic adapter parameters
  140.          GPINIT;                         Initialize graphic display
  141.          GPTERM;                         Terminate graphic display
  142.  
  143.          GPCOLOR(b);                     Set current color
  144.          GPMERGE(b);                     Set current merge mode
  145.          GPSTYLE(array);                 Set pattern for drawing lines
  146.          GPSHADE(array);                 Set pattern for shading areas
  147.          GPRDCLR;                        Return the current color
  148.  
  149.          GPPAL(p,v);                     Set a palette register
  150.          GPCPAL(p,v);                    Set a palette register using RGB
  151.          GPLDPAL(array);                 Load all palette registers
  152.          GPRDPAL(p);                     Read current palette setting
  153.  
  154.          GPPLOT(X,Y);                    Plot a point at X,Y (sets new CP)
  155.          GPRDDOT(X,Y)                    Read pixel at coordinates (X,Y)
  156.          GPMOVE(X,Y);                    Set current graphic position (CP)
  157.          GPLINE(X,Y);                    Draw a line from (CP) to X,Y
  158.          GPPOLY(array,N);                Draw a N number of lines
  159.          GPRECT(X,Y);                    Draw a rectangle between CP and (X,Y)
  160.          GPCIR(R);                       Draw a circle at CP with R radius
  161.  
  162.          GPWTROW(Array,N);               Write a row of pixels
  163.          GPWTCOL(Array,N);               Write a column of pixels
  164.          GPRDROW(Array,N);               Read a row of pixels
  165.          GPRDCOL(Array,N);               Read a column of pixels
  166.  
  167.          GPBOX(X,Y);                     Draws a solid box with color/shading
  168.          GPBAL(R);                       Draws a solid circle with color/shading
  169.  
  170.          GPSCROLL(Dir,I,N);              Scroll current viewport
  171.  
  172.          GPVIEWPORT(X1,Y1,X2,Y2);        Set current viewport
  173.          GPWINDOW(X1,Y1,X2,Y2);          Set current window
  174.          GPCLIP1(X,Y);                   Clip point in current window
  175.          GPCLIP2(X1,Y1,X2,Y2);           Clip line in current window
  176.          GPSCALE(X,Y);                   Scale from world to device
  177.  
  178.          GPFILL(Border);                 Simple object fill, color/shading
  179.          GPFLOOD(Border);                Complex object fill, color/shading
  180.  
  181.  
  182.                                                         DATE:   02/03/86
  183.                                                         SYSTEM: KC-TPEGA
  184.  
  185.  
  186.                         List of Global Variables
  187.  
  188.  
  189.          Global Variable                 Description
  190.         ----------------------------    ---------------------------------
  191.          GDTYPE:        Integer;         3 = CG, 4 = Mono, 5 = Color
  192.          GDOTHER:                        Internal Use Only
  193.          GDMEMORY:      Integer;         Amount of memory, 64 -> 256
  194.          GDMAXCOL:      Integer;         Maximum column (639 for EGA)
  195.          GDMAXROW:      Integer;         Maximum row (199/349 for EGA)
  196.          GDMAXPAL:      Integer;         Maximum palettes (4/16 for EGA)
  197.          GDMAXCLR:      Integer;         Maximum colors (63 for EGA)
  198.  
  199.          GDCOLOR:       Integer;         Current color for drawing
  200.          GDMERGE:                        Internal Use Only
  201.          GDSTYLE:                        Internal Use Only
  202.          GDSHADE:                        Internal Use Only
  203.          GDSHADE1:                       Internal Use Only
  204.          GDASPC1:       Integer;         Aspect for circles (3 for EGA)
  205.          GDASPC2:       Integer;         Aspect for circles (4 for EGA)
  206.          GDCUR_X:       Integer;         Current X coordinate
  207.          GDCUR_Y:       Integer;         Current Y coordinate
  208.  
  209.          GDGSEG:                         Internal Use Only
  210.          GDGSADR:                        Internal Use Only
  211.  
  212.          GDWD_X1:       Integer;         Window coordinate (low)
  213.          GDWD_X2:       Integer;         Window coordinate (high)
  214.          GDWD_X3:       Integer;         Window coordinate (delta+1)
  215.          GDWD_Y1:       Integer;         Window coordinate (low)
  216.          GDWD_Y2:       Integer;         Window coordinate (high)
  217.          GDWD_Y3:       Integer;         Window coordinate (delta+1)
  218.  
  219.          GDVW_X1:       Integer;         Viewport coordinate (low)
  220.          GDVW_X2:       Integer;         Viewport coordinate (high)
  221.          GDVW_X3:       Integer;         Viewport coordinate (delta+1)
  222.          GDVW_Y1:       Integer;         Viewport coordinate (low)
  223.          GDVW_Y2:       Integer;         Viewport coordinate (high)
  224.          GDVW_Y3:       Integer;         Viewport coordinate (delta+1)
  225.  
  226.          GDC_FLG:       Integer;         Last plot clipping status
  227.          GDS_FLG:       Integer;         Color/Shade or Color/Style flag
  228.          GDW_FLG:       Integer;         Enable/Disable World coordinates
  229.  
  230.          GDCURX1:       Integer;         World current X coordinate
  231.          GDCURY1:       Integer;         World current Y coordinate
  232.  
  233.  
  234.                                                         DATE:   02/03/86
  235.                                                         SYSTEM: KC-TPEGA
  236.  
  237.  
  238.  
  239.         NAME:
  240.  
  241.                 GPPARMS -- Setup current graphic adapter parameters
  242.  
  243.         SYNOPSIS:
  244.  
  245.                 P: procedure GPPARMS;
  246.  
  247.                 C: void GPPARMS();
  248.  
  249.         DESCRIPTION:
  250.  
  251.                 This procedure will initialize various global variables
  252.             on the status of the current graphic adapter.  If only needs
  253.             to be executed once in the life of a program.
  254.  
  255.         RETURNS:
  256.  
  257.             GDTYPE = 0, no ega, monochrome adapter (text mode) { maybe }
  258.                    = 1, no ega, old color graphic adapter (CG) { maybe }
  259.                    = 2, EGA with old color graphic monitor (320x200x16)
  260.                    = 3, EGA with old color graphic monitor (640x200x16)
  261.                    = 4, EGA with monochrome monitor (640x350x4)
  262.                    = 5, EGA with new Enhanced Color Display (640x350x16)
  263.                    = 6, ?
  264.  
  265.         CAUTIONS:
  266.  
  267.             This procedure MUST be performed before any other primitive.
  268.                            ----
  269.         EXAMPLE:
  270.  
  271.             P: GPPARMS;                    { Determine the type of Adapter }
  272.  
  273.                if GDTYPE <> 4 and GDTYPE <> 5 then   { 4 = mono, 5 = color }
  274.                  begin
  275.                  writeln('Must have IBM Enhanced Graphic Display!');
  276.                  halt(1);
  277.                  end;
  278.  
  279.             C: GPPARMS();
  280.  
  281.                if (GDTYPE != 5)
  282.                  {
  283.                  fprintf(stderr,'Must have EGA color display!\n');
  284.                  exit(1);
  285.                  };
  286.  
  287.  
  288.                                                         DATE:   02/03/86
  289.                                                         SYSTEM: KC-TPEGA
  290.  
  291.  
  292.  
  293.         NAME:
  294.  
  295.                 GPINIT -- Initialize the Enhanced Graphic Adapter
  296.  
  297.         SYNOPSIS:
  298.  
  299.                 P: PROCEDURE GPINIT;
  300.  
  301.                 C: GPINIT();
  302.  
  303.         DESCRIPTION:
  304.  
  305.                 This procedure will place the EGA in color or mono
  306.             graphic mode depending on hardware connected to the EGA.
  307.             This routine can be repeated to reset graphic state. If
  308.             you are using the standard color monitor with the EGA,
  309.             will setup in 640x200 (16 colors) mode, else 640x350.
  310.  
  311.         CAUTIONS:
  312.  
  313.                 The procedure 'GPPARMS' must be used to determine if
  314.             an EGA is available. The EGA must be placed in graphic mode
  315.             before executing the other graphic routines (not including
  316.             'GPPARMS').
  317.  
  318.         EXAMPLE:
  319.  
  320.             P: GPPARMS;                 { Determine the type of Adapter }
  321.  
  322.                if GDTYPE <> 4 and GDTYPE <> 5 then
  323.                  begin
  324.                  write('Must have IBM Enhanced Graphic Display!');
  325.                  halt;
  326.                  end
  327.                else
  328.                  begin
  329.                  GPInit;                 { Initialize the EGA           }
  330.                  end;
  331.  
  332.             C: GPPARMS();
  333.  
  334.                if (GDTYPE != 4)
  335.                  {
  336.                  fprintf(stderr,'Must have EGA monochrome display!\n');
  337.                  exit(1);
  338.                  }
  339.                else
  340.                  {
  341.                  GPINIT();
  342.                  };
  343.  
  344.         SEE ALSO:
  345.  
  346.             GPPARMS and GPTERM.
  347.  
  348.  
  349.                                                         DATE:   02/03/86
  350.                                                         SYSTEM: KC-TPEGA
  351.  
  352.  
  353.  
  354.         NAME:
  355.  
  356.                 GPTERM -- Terminate graphic mode and return to text
  357.  
  358.         SYNOPSIS:
  359.  
  360.                 P: procedure GPTERM;
  361.  
  362.                 C: void GPTERM;
  363.  
  364.         DESCRIPTION:
  365.  
  366.                 This procedure will return the EGA back to text mode.
  367.                 Mode 3 for color EGA and mode 7 for monochrome monitors.
  368.  
  369.         CAUTIONS:
  370.  
  371.                 Should not be performed on a non EGA computer.
  372.  
  373.         EXAMPLES:
  374.  
  375.             P: GPTERM;
  376.  
  377.             C: GPTERM();
  378.  
  379.         SEE ALSO:
  380.  
  381.             GPPARMS and GPINIT.
  382.  
  383.  
  384.                                                         DATE:   02/03/86
  385.                                                         SYSTEM: KC-TPEGA
  386.  
  387.  
  388.  
  389.         NAME:
  390.  
  391.                 GPCOLOR -- Set the current color
  392.  
  393.         SYNOPSIS:
  394.  
  395.                 P: procedure GPCOLOR(Value: Integer);
  396.  
  397.                 C: void GPCOLOR(Value)
  398.                      int Value;
  399.  
  400.         DESCRIPTION:
  401.  
  402.                 Set the color to be used by the other ploting routines
  403.             (GPPLOT, GPLINE, GPRECT, etc...).  The primitive GPRDCLR can
  404.             can be used to read the current color. The global GDMAXPAL will
  405.             contain the highest color value allowed.   Setting the color
  406.             will set the style/shading flag to zero, this will cause all
  407.             drawing and filling primitives to use the current color and
  408.             not the current style/shading.  Use the Turbo Pascal function
  409.             TEXTCOLOR for text coloring.
  410.  
  411.         EXAMPLE:
  412.  
  413.             P: GPCOLOR(Green);             { Set color to Green     }
  414.                GPMOVE(50,50);              { Draw a green rectangle }
  415.                GPRECT(100,100);
  416.  
  417.             C: color = GPRDCLR;            /* Save the current color */
  418.  
  419.                GPCOLOR(Red);               /* Define a new color     */
  420.  
  421.                GPMOVE(X1,Y1);              /* Draw a red line        */
  422.                GPLINE(X2,Y2);
  423.  
  424.                GPCOLOR(color);             /* Restore color          */
  425.  
  426.         SEE ALSO:
  427.  
  428.             GPRDCLR, GPSTYLE, GPSHADE.
  429.  
  430.  
  431.                                                         DATE:   02/03/86
  432.                                                         SYSTEM: KC-TPEGA
  433.  
  434.  
  435.  
  436.         NAME:
  437.  
  438.                 GPMERGE -- Set the placement of graphic data
  439.  
  440.         SYNOPSIS:
  441.  
  442.                 P: procedure GPMERGE(Value: Integer);
  443.  
  444.                 C: void GPMERGE(Value)
  445.                      int Value;
  446.  
  447.                                Merge modes, 0 - Store (default)
  448.                                             1 - AND
  449.                                             2 - OR
  450.                                             3 - XOR
  451.  
  452.         DESCRIPTION:
  453.  
  454.                 Specify the method which data is placed in the graphic
  455.             memory.  The various merge modes are performed with hardware
  456.             on the EGA.  Almost all graphic routines will be effected by
  457.             setting the merge value, but not all.
  458.  
  459.         CAUTIONS:
  460.  
  461.                 Setting non-zero merge mode can slow down some graphic
  462.            primitives. (e.g., GPFLOOD).
  463.  
  464.         EXAMPLE:
  465.  
  466.             P: GPMERGE(3);                    { Set merge mode to XOR }
  467.                GPCOLOR(Green);                { Set color to Green    }
  468.                GPMOVE(50,50);                 { XOR green box         }
  469.                GPBOX(100,100);
  470.                GPMERGE(0);                    { Return merge mode to default }
  471.  
  472.         SEE ALSO:
  473.  
  474.             GPFILL and GPFLOOD.
  475.  
  476.  
  477.                                                         DATE:   02/03/86
  478.                                                         SYSTEM: KC-TPEGA
  479.  
  480.  
  481.  
  482.         NAME:
  483.  
  484.                 GPSTYLE -- Set the current line style
  485.  
  486.         SYNOPSIS:
  487.  
  488.                 P: procedure GPSTYLE(var Style);
  489.  
  490.                 C: void GPSTYLE(Style)
  491.                      unsigned char Style[];
  492.  
  493.         DESCRIPTION:
  494.  
  495.                 Set the line style for the line drawing primitives.  The
  496.             parameter is an array of color bytes with the first byte con-
  497.             taining the length.  The style/shading flag will be set to
  498.             non-zero to flag the line routines to use the current line style
  499.             and not the current color setting.
  500.  
  501.         EXAMPLE:
  502.  
  503.             C: unsigned char Style[] =     /* Set line style to GGBB  */
  504.                  {4,Green,Green,Blue,Blue};
  505.  
  506.                GPSTYLE(Style);             /* Define the line style   */
  507.  
  508.                GPMOVE(X1,Y1);
  509.                GPLINE(X2,Y2);              /* Draw line using style   */
  510.  
  511.                GPCOLOR(color);             /* Set color               */
  512.  
  513.                GPLINE(X3,Y3);              /* Draw green line         */
  514.  
  515.                GPS_FLG := -1;              /* Goback to style setting */
  516.  
  517.                GPLINE(X4,Y4);              /* Draw line using style   */
  518.  
  519.         SEE ALSO:
  520.  
  521.             GPCOLOR.
  522.  
  523.  
  524.                                                         DATE:   02/03/86
  525.                                                         SYSTEM: KC-TPEGA
  526.  
  527.  
  528.  
  529.         NAME:
  530.  
  531.                 GPSHADE -- Set the current fill/flood shading
  532.  
  533.         SYNOPSIS:
  534.  
  535.                 P: procedure GPSHADE(var Style);
  536.  
  537.                 C: void GPSHADE(Style)
  538.                      unsigned char Style[];
  539.  
  540.         DESCRIPTION:
  541.  
  542.                 Set the shading matrix for fill/flooding primitives.  The
  543.             parameter is an array of color bytes with the first byte con-
  544.             taining the width and the second containing the height.  The
  545.             style/shading flag (GDS_FLG) will be set to a non-zero value.
  546.  
  547.         CAUTIONS:
  548.  
  549.             Although any dimension from 1 to 255 can be used, the current
  550.             version of GPFILL and GPFLOOD only works correctly with shade
  551.             of dimensions of 1,2,4 or 8 (x and y can be different).  This
  552.             restriction will be removed in the future.
  553.  
  554.         EXAMPLE:
  555.  
  556.             C: unsigned char Shade[] =     /* Set fill shade to GBGB  */
  557.                  {2,2,Green,Blue,Blue,Green};    /* 2 by 2 array */
  558.  
  559.                GPSHADE(Shade);             /* Define the shading      */
  560.  
  561.                GPMOVE(X1,Y1);
  562.                GPFLOOD(color);             /* Flood area with border
  563.                                               defined by color        */
  564.  
  565.         SEE ALSO:
  566.  
  567.             GPCOLOR, GPSTYLE, GPFILL and GPFLOOD.
  568.  
  569.  
  570.                                                         DATE:   02/03/86
  571.                                                         SYSTEM: KC-TPEGA
  572.  
  573.  
  574.  
  575.         NAME:
  576.  
  577.                 GPRDCLR -- Read the current color
  578.  
  579.         SYNOPSIS:
  580.  
  581.                 P: function GPRDCLR: Integer;
  582.  
  583.                 C: int GPRDCLR();
  584.  
  585.         DESCRIPTION:
  586.  
  587.                 Return the current color setting.  Use to save the current
  588.             color setting.
  589.  
  590.         RETURN:
  591.  
  592.                 The current color setting.
  593.  
  594.         EXAMPLE:
  595.  
  596.             C: color = GPRDCLR;            /* Save the current color */
  597.  
  598.                GPCOLOR(Red);               /* Define a red line      */
  599.  
  600.                GPMOVE(X1,Y1);
  601.                GPLINE(X2,Y2);              /* Draw a red line        */
  602.  
  603.                GPCOLOR(color);             /* Restore color          */
  604.  
  605.         SEE ALSO:
  606.  
  607.             GPCOLOR.
  608.  
  609.  
  610.                                                         DATE:   02/03/86
  611.                                                         SYSTEM: KC-TPEGA
  612.  
  613.  
  614.  
  615.         NAME:
  616.  
  617.                 GPPAL -- Set a palette register
  618.  
  619.         SYNOPSIS:
  620.  
  621.                 P: procedure GPPAL(Palette, Color: Integer);
  622.  
  623.                 C: void GPPAL(Palette, Color)
  624.                      int Palette, Color;
  625.  
  626.         DESCRIPTION:
  627.  
  628.                 Set a palette to a given color value.  The maximum range
  629.             of the palette variable is contained in GDMAXPAL. The max
  630.             range of the color variable in contained in GDMAXCLR. These
  631.             two global variables are set by the routine 'GPPARMS'.   If
  632.             -1 is the palette value then the border is set to the given
  633.             color.
  634.  
  635.         CAUTIONS:
  636.  
  637.                 Setting the border color is not recommended for the EGA.
  638.  
  639.         EXAMPLE:
  640.  
  641.             P: GPPAL(5,20);                { Set palette 5 to color 20  }
  642.  
  643.         SEE ALSO:
  644.  
  645.             GPCPAL and GPRDPAL.
  646.  
  647.                                                         DATE:   02/03/86
  648.                                                         SYSTEM: KC-TPEGA
  649.  
  650.  
  651.  
  652.         NAME:
  653.  
  654.                 GPCPAL -- Set a palette register using R,G,B
  655.  
  656.         SYNOPSIS:
  657.  
  658.                 P: procedure GPCPAL(Palette, R, G, B: Integer);
  659.  
  660.                 C: void GPCPAL(Palette, R, G, B)
  661.                      int Palette, R, G, B;
  662.  
  663.         DESCRIPTION:
  664.  
  665.                 Set a palette to a given color using the RGB values.
  666.             The max value of each primary color can be determine by the
  667.             (cube root of (GDMAXCLR+1) - 1).  If -1 is the palette value
  668.             then the border is set to the given color.
  669.  
  670.         CAUTIONS:
  671.  
  672.                 Setting the border color is not recommended for the EGA.
  673.  
  674.         EXAMPLE:
  675.  
  676.             P: GPCPAL(5,2,1,0);            { Set palette 5 to RGB(2,1,0)}
  677.  
  678.         SEE ALSO:
  679.  
  680.             GPPAL and GPRDPAL.
  681.  
  682.                                                         DATE:   02/03/86
  683.                                                         SYSTEM: KC-TPEGA
  684.  
  685.  
  686.  
  687.         NAME:
  688.  
  689.                 GPLDPAL -- Set all the palette registers
  690.  
  691.         SYNOPSIS:
  692.  
  693.                 P: procedure GPLDPAL(var Palettes : Bytes);
  694.  
  695.                 P: void GPLDPAL(Palettes)
  696.                      unsigned char Palettes[];
  697.  
  698.         DESCRIPTION:
  699.  
  700.                 Load all the palette registers from a given array.  The
  701.             number of palettes can be determine by GDMAXPAL + 2.  The
  702.             border color is located in GDMAXPAL + 2.
  703.  
  704.         CAUTIONS:
  705.  
  706.                 Setting the border color is not recommended for the EGA.
  707.  
  708.         EXAMPLE:
  709.  
  710.             P: pals: array [0..16] of byte; { pals[0] > pals[15] colors }
  711.                                             { pals[16] border color     }
  712.  
  713.                for i := 0 to 15 do          { Reset to default colors   }
  714.                  begin
  715.                  if i < 8 then
  716.                    pals[i] := i
  717.                  else
  718.                    pals[i] := 48 + i;
  719.  
  720.                pals[16] := 0;               { Keep border Black         }
  721.  
  722.                GPLDPAL(pals);               { Set palettes and border   }
  723.  
  724.  
  725.                                                         DATE:   02/03/86
  726.                                                         SYSTEM: KC-TPEGA
  727.  
  728.  
  729.  
  730.         NAME:
  731.  
  732.                 GPRDPAL -- Set a palette register
  733.  
  734.         SYNOPSIS:
  735.  
  736.                 P: function GPRDPAL(Palette: Integer): Integer;
  737.  
  738.                 C: int GPRDPAL(Palette)
  739.                      int Palette;
  740.  
  741.         DESCRIPTION:
  742.  
  743.                 Read the setting of the specified palette register.  If
  744.             an EGA save area has not be defined then this function will
  745.             return -1 instead of a palette color.  Use the program
  746.             'KCSETPAL' to define a save area.
  747.  
  748.         RETURN:
  749.  
  750.                 Palette color or -1 if can be found. (run KCSETPAL).
  751.  
  752.         EXAMPLE:
  753.  
  754.             C: current_color = GPRDPAL(5)  /* Read palette 5  */
  755.  
  756.                if (current_color == -1)    /* Recover on null */
  757.                  current_color = 5;
  758.  
  759.         SEE ALSO:
  760.  
  761.             GPPAL.
  762.  
  763.  
  764.                                                         DATE:   02/03/86
  765.                                                         SYSTEM: KC-TPEGA
  766.  
  767.  
  768.  
  769.         NAME:
  770.  
  771.                 GPPLOT -- Plot a pixel at the given corrdinate
  772.  
  773.         SYNOPSIS:
  774.  
  775.                 P: procedure GPPLOT(x,y: Integer);
  776.  
  777.                 C: void GPPLOT(x,y)
  778.                      int x,y;
  779.  
  780.         DESCRIPTION:
  781.  
  782.                 Plot a point at the given coordinates using the current
  783.             color and merge values.  The upper left corner is (0,0) on
  784.             the graphic screen.  The specifed (X,Y) coordinate becomes
  785.             the new current position (CP).  Automatic clipping is
  786.             preformed.
  787.  
  788.         RETURN:
  789.  
  790.             GDC_FLG = 0 if point is in the current viewport.
  791.                       2 if point out of current viewport (not plotted)
  792.  
  793.         EXAMPLE:
  794.  
  795.             P: GPCOLOR(Green);          { Set color to Green            }
  796.                GPPLOT(5,5);             { Plot a Green pixels at (5,5)  }
  797.                GPLINE(9,9);             { Draw line from (5,5) to (9,9) }
  798.  
  799.         SEE ALSO:
  800.  
  801.             GPCOLOR, GPMERGE and GPMOVE.
  802.  
  803.  
  804.                                                         DATE:   02/03/86
  805.                                                         SYSTEM: KC-TPEGA
  806.  
  807.  
  808.  
  809.         NAME:
  810.  
  811.                 GPRDDOT -- Read the pixel at the given corrdinate
  812.  
  813.         SYNOPSIS:
  814.  
  815.                 P: function GPRDDOT(x,y: Integer): Integer;
  816.  
  817.                 C: int GPRDDOT(x,y)
  818.                      int x,y;
  819.  
  820.         DESCRIPTION:
  821.  
  822.                 Read the pixel at the given coordinates.
  823.  
  824.         CAUTIONS:
  825.  
  826.                 The global variable GDMEMORY is used to determine the
  827.             number of planes to read (two for 64k, and four 128k+)
  828.  
  829.         EXAMPLE:
  830.  
  831.             P: color: Integer;
  832.  
  833.                color := GPRDDOT(5,4)    { Read color at (5,4)           }
  834.  
  835.         SEE ALSO:
  836.  
  837.             GPPARMS.
  838.  
  839.  
  840.                                                         DATE:   02/03/86
  841.                                                         SYSTEM: KC-TPEGA
  842.  
  843.  
  844.  
  845.         NAME:
  846.  
  847.                 GPMOVE -- Move graphic cursor to new position
  848.  
  849.         SYNOPSIS:
  850.  
  851.                 P: procedure GPMOVE(x,y: Integer);
  852.  
  853.                 C: void GPMOVE(x,y)
  854.                      int x,y;
  855.  
  856.         DESCRIPTION:
  857.  
  858.                 Set the graphic cursor to the specified position to be
  859.             the new current position (CP).
  860.  
  861.         EXAMPLE:
  862.  
  863.             P: GPCOLOR(Green);          { Set color to Green            }
  864.                GPMOVE(5,5);             { Set CP to (5,5)               }
  865.                GPLINE(9,9);             { Draw line from (5,5) to (9,9) }
  866.  
  867.         SEE ALSO:
  868.  
  869.             GPPLOT and GPLINE.
  870.  
  871.  
  872.                                                         DATE:   02/03/86
  873.                                                         SYSTEM: KC-TPEGA
  874.  
  875.  
  876.  
  877.         NAME:
  878.  
  879.                 GPLINE -- Draw a line from CP to (X,Y)
  880.  
  881.         SYNOPSIS:
  882.  
  883.                 P: procedure GPLINE(x,y: Integer);
  884.  
  885.                 C: void GPLINE(x,y)
  886.                      int x,y;
  887.  
  888.         DESCRIPTION:
  889.  
  890.                 Draw a line from the current position (CP) to the given
  891.             coordinate using the current merge, color or line style values.
  892.             Automatic line clipping is performed in the current viewport.
  893.  
  894.         RETURN:
  895.  
  896.             GDC_FLG = 0 if line is in the current viewport.
  897.                       1 if line was clipped, but still plotted (part of)
  898.                       2 if line out of current viewport (not plotted)
  899.  
  900.         EXAMPLE:
  901.  
  902.             P: GPCOLOR(Green);          { Set color to Green            }
  903.                GPMOVE(5,5);             { Set CP to (5,5)               }
  904.                GPLINE(9,9);             { Draw line from (5,5) to (9,9) }
  905.  
  906.         SEE ALSO:
  907.  
  908.             GPCOLOR, GPMERGE, GPSTYLE and GPMOVE.
  909.  
  910.  
  911.                                                         DATE:   02/03/86
  912.                                                         SYSTEM: KC-TPEGA
  913.  
  914.  
  915.  
  916.         NAME:
  917.  
  918.                 GPPOLY -- Connect an array of points
  919.  
  920.         SYNOPSIS:
  921.  
  922.                 P: procedure GPPOLY(var points; N: Integer);
  923.  
  924.                 C: void GPLINE(points,n)
  925.                      int points[]
  926.                      int n;
  927.  
  928.         DESCRIPTION:
  929.  
  930.                 Starting from the CP, connect each point with a line.
  931.  
  932.         EXAMPLE:
  933.  
  934.             P: GPCOLOR(Green);          { Set color to Green            }
  935.                GPMOVE(5,5);             { Set CP to (5,5)               }
  936.                GPPOLY(car,50);          { Draw a car                    }
  937.  
  938.         SEE ALSO:
  939.  
  940.             GPLINE.
  941.  
  942.  
  943.                                                         DATE:   02/03/86
  944.                                                         SYSTEM: KC-TPEGA
  945.  
  946.  
  947.  
  948.         NAME:
  949.  
  950.                 GPRECT -- Draw a rectangle
  951.  
  952.         SYNOPSIS:
  953.  
  954.                 P: procedure GPRECT(x,y: Integer);
  955.  
  956.                 C: void GPRECT(x,y)
  957.                      int x,y;
  958.  
  959.         DESCRIPTION:
  960.  
  961.                 Draws a rectangle with CP and given x,y coordinates.
  962.             The X,Y coordinates becomes the new CP.
  963.  
  964.         EXAMPLE:
  965.  
  966.             P: GPCOLOR(Green);          { Set color to Green            }
  967.                GPMOVE(5,5);             { Set CP to (5,5)               }
  968.                GPRECT(10,10);           { Draw a rectangle              }
  969.  
  970.         SEE ALSO:
  971.  
  972.             CPCOLOR, GPMOVE and GPLINE.
  973.  
  974.  
  975.                                                         DATE:   02/03/86
  976.                                                         SYSTEM: KC-TPEGA
  977.  
  978.  
  979.  
  980.         NAME:
  981.  
  982.                 GPCIR -- Draw a circle around the CP
  983.  
  984.         SYNOPSIS:
  985.  
  986.                 P: procedure GPCIR(radius: Integer);
  987.  
  988.                 C: void GPCIR(radius)
  989.                      int radius;
  990.  
  991.         DESCRIPTION:
  992.  
  993.                 Starting from the CP, draw a circle with the given radius
  994.             around it clipping in the current viewport.
  995.  
  996.         RETURN:
  997.  
  998.             GDC_FLG = 0 if circle is in the current viewport.
  999.                       1 if circle was clipped, but still plotted (part of)
  1000.                       2 if circle out of current viewport (not plotted)
  1001.  
  1002.         CAUTIONS:
  1003.  
  1004.             The current line style can not be used only the color value.
  1005.  
  1006.         EXAMPLE:
  1007.  
  1008.             P: GPCOLOR(Green);          { Set color to Green            }
  1009.                GPMOVE(100,100);         { Set CP to (5,5)               }
  1010.                GPCIR(50);               { Draw a circle                 }
  1011.  
  1012.         SEE ALSO:
  1013.  
  1014.             GPMOVE.
  1015.  
  1016.  
  1017.                                                         DATE:   02/03/86
  1018.                                                         SYSTEM: KC-TPEGA
  1019.  
  1020.  
  1021.  
  1022.         NAME:
  1023.  
  1024.                 GPWTROW -- Write a row of pixels
  1025.  
  1026.         SYNOPSIS:
  1027.  
  1028.                 P: procedure GPWTROW(var Pixels: Byte; N: Integer);
  1029.  
  1030.                 C: void GPWTROW(Pixels,N)
  1031.                      unsigned char Pixels[];
  1032.                      int N;
  1033.  
  1034.         DESCRIPTION:
  1035.  
  1036.                 Write a row of pixels from the current position (CP), N
  1037.             pixels wide using the specifed byte array of colors.
  1038.  
  1039.         CAUTIONS:
  1040.  
  1041.                 If the row of pixels leave the edge of the screen, the
  1042.             rest will appear on the other side. (Can be a plus).
  1043.  
  1044.         EXAMPLE:
  1045.  
  1046.             P: Pixels: array [0.63] of byte;
  1047.  
  1048.                GPMOVE(5,5);
  1049.                GPWTROW(Pixels,64);
  1050.  
  1051.         SEE ALSO:
  1052.  
  1053.             GPMOVE, and GPWTCOL.
  1054.  
  1055.  
  1056.                                                         DATE:   02/03/86
  1057.                                                         SYSTEM: KC-TPEGA
  1058.  
  1059.  
  1060.  
  1061.         NAME:
  1062.  
  1063.                 GPWTCOL -- Write a column of pixels
  1064.  
  1065.         SYNOPSIS:
  1066.  
  1067.                 P: procedure GPWTCOL(var Pixels: Byte; N: Integer);
  1068.  
  1069.                 C: void GPWTCOL(Pixels,N)
  1070.                      unsigned char Pixels[];
  1071.                      int N;
  1072.  
  1073.         DESCRIPTION:
  1074.  
  1075.                 Write a column of pixels from the current position (CP),
  1076.             N pixels high using the specifed byte array of colors.
  1077.  
  1078.         CAUTIONS:
  1079.  
  1080.                 If the column of pixels leave the edge of the screen,
  1081.             the rest will appear on the other side. (Can be a plus).
  1082.  
  1083.         EXAMPLE:
  1084.  
  1085.             P: Pixels: array [0.63] of byte;
  1086.  
  1087.                GPMOVE(5,5);
  1088.                GPWTROW(Pixels,64);
  1089.  
  1090.         SEE ALSO:
  1091.  
  1092.             GPMOVE, and GPWTROW.
  1093.  
  1094.  
  1095.                                                         DATE:   02/03/86
  1096.                                                         SYSTEM: KC-TPEGA
  1097.  
  1098.  
  1099.  
  1100.         NAME:
  1101.  
  1102.                 GPBOX -- Fills in specified box with current color
  1103.  
  1104.         SYNOPSIS:
  1105.  
  1106.                 P: procedure GPBOX(x,y: Integer);
  1107.  
  1108.                 C: void GPBOX(x,y)
  1109.                      int x,y;
  1110.  
  1111.         DESCRIPTION:
  1112.  
  1113.                 Fills the specified area (box shaped) using the current
  1114.             color and merge value.  Normally used to clear the screen or
  1115.             reverse an area using merge XOR setting.  The CP and the
  1116.             specified X,Y coordinates are used as the corners of the box.
  1117.  
  1118.         RETURN:
  1119.  
  1120.             GDC_FLG = 0 if box is in the current viewport.
  1121.                       1 if box was clipped, but still plotted (part of)
  1122.                       2 if box out of current viewport (not plotted)
  1123.  
  1124.         EXAMPLE:
  1125.  
  1126.             P: GPCOLOR(Black);
  1127.                GPMOVE(0,0);
  1128.                GPBOX(GDMAXCOL,GDMAXROW); { Clear Screen }
  1129.  
  1130.             C: GPCOLOR(GDMAXCLR)            /* Load 0x0F to reverse bits */
  1131.                GPMERGE(3);                  /* Set merge mode to XOR     */
  1132.                GPMOVE(50,50);
  1133.                GPBOX(100,100);              /* Reverse bits in this box  */
  1134.  
  1135.         SEE ALSO:
  1136.  
  1137.             GPCOLOR, GPMERGE.
  1138.  
  1139.  
  1140.                                                         DATE:   02/03/86
  1141.                                                         SYSTEM: KC-TPEGA
  1142.  
  1143.  
  1144.  
  1145.         NAME:
  1146.  
  1147.                 GPBALL -- Fills in specified circle with color/shade
  1148.  
  1149.         SYNOPSIS:
  1150.  
  1151.                 P: procedure GPBALL(Radius: Integer);
  1152.  
  1153.                 C: void GPBALL(Radius)
  1154.                      int Radius;
  1155.  
  1156.         DESCRIPTION:
  1157.  
  1158.                 Fills the specified area (ball shaped) using the current
  1159.             color and merge value.
  1160.  
  1161.         RETURN:
  1162.  
  1163.             GDC_FLG = 0 if ball is in the current viewport.
  1164.                       1 if ball was clipped, but still plotted (part of)
  1165.                       2 if ball out of current viewport (not plotted)
  1166.  
  1167.         EXAMPLE:
  1168.  
  1169.             P: GPCOLOR(Blue);
  1170.                GPMOVE(100,100)
  1171.                GPBALL(50);
  1172.  
  1173.         SEE ALSO:
  1174.  
  1175.             GPCIR, GPCOLOR and GPSHADE.
  1176.  
  1177.  
  1178.                                                         DATE:   02/03/86
  1179.                                                         SYSTEM: KC-TPEGA
  1180.  
  1181.  
  1182.  
  1183.         NAME:
  1184.  
  1185.                 GPSCROLL -- Scroll the current viewport
  1186.  
  1187.         SYNOPSIS:
  1188.  
  1189.                 P: procedure GPSCROLL(Dir, N: Integer);
  1190.  
  1191.                 C: void GPSCROLL(Dir, N)
  1192.                      int  Dir, N;
  1193.  
  1194.         DESCRIPTION:
  1195.  
  1196.                 Scroll the viewport in the specified direction by N
  1197.             lines.  The viewport to be scrolled must be a byte boundary.
  1198.             (x coordinate only).  The direction code is defined as:
  1199.  
  1200.                             0    4   12
  1201.                             1    5   13
  1202.                             3    7   15
  1203.  
  1204.         EXAMPLE:
  1205.  
  1206.             P: GPVIEWPORT(48,50,95,100);
  1207.  
  1208.                GPSCROLL(4,1);   { Scroll the viewport up by one line }
  1209.  
  1210.         SEE ALSO:
  1211.  
  1212.             GPVIEWPORT.
  1213.  
  1214.  
  1215.                                                         DATE:   02/03/86
  1216.                                                         SYSTEM: KC-TPEGA
  1217.  
  1218.  
  1219.  
  1220.         NAME:
  1221.  
  1222.                 GPVIEWPORT -- Specified an area to plot graphic commands
  1223.  
  1224.         SYNOPSIS:
  1225.  
  1226.                 P: procedure GPVIEWPORT(x1,y1,x2,y2: Integer);
  1227.  
  1228.                 C: void GPVIEWPORT(x1,y1,x2,y2)
  1229.                      int x1,y1; /* lower left corner of viewport  */
  1230.                      int x2,y2; /* upper right corner of viewport */
  1231.  
  1232.         DESCRIPTION:
  1233.  
  1234.                 Specify an area on the screen to perform graphic function.
  1235.             The viewport parameters are in Graphic Device Units (GDU). The
  1236.             IBM's Enhance Graphic Adapter is 640x350 GDUs.  The 'GPINIT'
  1237.             function will perform viewport(0,0,639,349).  This function is
  1238.             simular to the Turbo's GraphWindow or BASIC's Viewport.  The
  1239.             basic graphic primitives are clipped using the current viewport.
  1240.  
  1241.         EXAMPLE:
  1242.  
  1243.             GPVIEWPORT(50,50,600,300); { Define viewport }
  1244.                                                  |
  1245.                 .-----------------------.        |
  1246.                 |(0,0)                  |        |
  1247.                 |   .---------------.   |        |
  1248.                 |   |(50,50)        |   |        |
  1249.                 |   |               <------------+
  1250.                 |   |               |   |
  1251.                 |   |      (600,300)|   |
  1252.                 |   `---------------'   |<--- Default Viewport
  1253.                 |              (639,349)|
  1254.                 `-----------------------'
  1255.  
  1256.         SEE ALSO:
  1257.  
  1258.             GPPLOT, GPLINE, GPCIR and GPWINDOW.
  1259.  
  1260.  
  1261.                                                         DATE:   02/03/86
  1262.                                                         SYSTEM: KC-TPEGA
  1263.  
  1264.  
  1265.  
  1266.         NAME:
  1267.  
  1268.                 GPWINDOW -- specified a set coordinates
  1269.  
  1270.         SYNOPSIS:
  1271.  
  1272.                 procedure GPWindow(x1,y1,x2,y2: Integer);
  1273.  
  1274.                 int  x1,y1;     lower left corner of window
  1275.                 int  x2,y2;     upper right corner of window
  1276.  
  1277.         DESCRIPTION:
  1278.  
  1279.                 Specify a new set of coordinates for the current viewport.
  1280.             The coordinates are signed integers (-32768 <--> +32767).  It
  1281.             is simular to the BASIC's Window function.  The graphic
  1282.             primitives GPSCALE, GPCLIP1 and GPCLIP2 can be used for scaling
  1283.             and clipping using the current window.  See the file WORLD.P
  1284.             for function that support the world coordinate system.
  1285.  
  1286.         RETURNS:
  1287.  
  1288.             None.
  1289.  
  1290.         CAUTIONS:
  1291.  
  1292.                 If the viewport and window coordinates are different then
  1293.             an extra scaling process is perform on graphic functions.  No
  1294.             checks are performed on input parameters.
  1295.  
  1296.         EXAMPLE:
  1297.  
  1298.             GPViewport(50,50,600,300);    { Define viewport }
  1299.             GPWindow(-100,-100,100,100); { Define a new set of corrdinates }
  1300.                                                  |
  1301.                 .-----------------------.        |
  1302.                 |(0,0)                  |        |
  1303.                 |   .---------------.   |        |
  1304.                 |   |(-100,-100)    |   |        |
  1305.                 |   |               <------------+
  1306.                 |   |               |   |
  1307.                 |   |      (100,100)|   |
  1308.                 |   `---------------'   |<--- Default Viewport
  1309.                 |              (639,349)|
  1310.                 `-----------------------'
  1311.  
  1312.         SEE ALSO:
  1313.  
  1314.             GPVIEWPORT, and GPSCALE.
  1315.  
  1316.                                                         DATE:   02/03/86
  1317.                                                         SYSTEM: KC-TPEGA
  1318.  
  1319.  
  1320.  
  1321.         NAME:
  1322.  
  1323.                 GPCLIP1 -- Clip a point within the current viewport
  1324.  
  1325.         SYNOPSIS:
  1326.  
  1327.                 P: function GPCLIP1(var x,y: Integer): Integer;
  1328.  
  1329.                 C: int GPCLIP1(x,y)
  1330.                      int x,y;
  1331.  
  1332.         DESCRIPTION:
  1333.  
  1334.                 Perform point clipping on the specifed point and return
  1335.             a zero (0) if the point is in the current viewport, else non-
  1336.             zero response.
  1337.  
  1338.         RETURN:
  1339.  
  1340.                 Zero, if inside viewport, else non-zero if outside.
  1341.  
  1342.         EXAMPLE:
  1343.  
  1344.             C: GPVIEWPORT(50,50,100,100);       /* Set current viewport */
  1345.  
  1346.                void PtAbs(x,y)                  /* Define WORLD routine */
  1347.                  int x,y;
  1348.                {
  1349.                  if (GPCLIP1(x,y) == 0)         /* Do boundary check    */
  1350.                    {
  1351.                    GPSCALE(x,y);                /* If inside viewport
  1352.                    GPPLOT(x,y);                      scale and plot     */
  1353.                    }
  1354.                }
  1355.  
  1356.         SEE ALSO:
  1357.  
  1358.             GPVIEWPORT, GPCLIP2, and GPSCALE.
  1359.  
  1360.  
  1361.                                                         DATE:   02/03/86
  1362.                                                         SYSTEM: KC-TPEGA
  1363.  
  1364.  
  1365.  
  1366.         NAME:
  1367.  
  1368.                 GPCLIP2 -- Clip a line within the current viewport
  1369.  
  1370.         SYNOPSIS:
  1371.  
  1372.                 P: function GPCLIP2(var x1,y1,x2,y2: Integer): Integer;
  1373.  
  1374.                 C: int GPCLIP2(x1,y1,x2,y2)
  1375.                      int *x1,*y1,*x2,*y2;
  1376.  
  1377.         DESCRIPTION:
  1378.  
  1379.                 Perform point clipping on the specifed line and return
  1380.             a zero (0) if the line is completly in the current viewport
  1381.             or an one (1) if line clipping was performed or two (2) if
  1382.             totally outside of the viewport.
  1383.  
  1384.         RETURN:
  1385.  
  1386.                 Returns zero (0) is the line is completly in the viewport
  1387.             (no clipping performed).  One (1) if the line was clip and the
  1388.             x1,y1,x2,y2 value now contain the clipped line.  Two (2) if
  1389.             the line is outside of the viewport.
  1390.  
  1391.         EXAMPLE:
  1392.  
  1393.             C: GPVIEWPORT(50,50,100,100);       /* Set current viewport */
  1394.  
  1395.                if (GPCLIP2(x1,y1,x2,y2) != 2)   /* Do boundary check    */
  1396.                  {
  1397.                  GPSCALE(x1,y1);                /* If inside viewport
  1398.                  GPMOVE(x1,y1);                      scale and draw     */
  1399.                  GPSCALE(x2,y2);
  1400.                  GPLINE(x2,y2);
  1401.                  }
  1402.                }
  1403.  
  1404.         SEE ALSO:
  1405.  
  1406.             GPVIEWPORT, GPCLIP1, and GPSCALE.
  1407.  
  1408.  
  1409.                                                         DATE:   02/03/86
  1410.                                                         SYSTEM: KC-TPEGA
  1411.  
  1412.  
  1413.  
  1414.         NAME:
  1415.  
  1416.                 GPSCALE -- Scale a world coordinate to viewport
  1417.  
  1418.         SYNOPSIS:
  1419.  
  1420.                 P: procedure GPSCALE(var x,y: Integer);
  1421.  
  1422.                 C: void GPSCALE(x,y)
  1423.                      int *x,*y;
  1424.  
  1425.         DESCRIPTION:
  1426.  
  1427.                 Scale the specifed point from world coordinates to the
  1428.             Device coordinates in the current viewport.
  1429.  
  1430.         RETURN:
  1431.  
  1432.                 Changes the X,Y coordinate to real (hardware) coordinates.
  1433.  
  1434.         EXAMPLE:
  1435.  
  1436.             C: GPWINDOW(0,0,1000,1000);         /* Set world coordinates */
  1437.                GPVIEWPORT(50,50,100,100);       /* Set current viewport  */
  1438.  
  1439.                if (GPCLIP2(x1,y1,x2,y2) != 2)   /* Do boundary check     */
  1440.                  {
  1441.                  GPSCALE(x1,y1);                /* If inside viewport
  1442.                  GPMOVE(x1,y1);                      scale and draw      */
  1443.                  GPSCALE(x2,y2);
  1444.                  GPLINE(x2,y2);
  1445.                  }
  1446.                }
  1447.  
  1448.         SEE ALSO:
  1449.  
  1450.             GPWINDOW, GPVIEWPORT, GPCLIP1, and GPGLIP2.
  1451.  
  1452.  
  1453.                                                         DATE:   02/03/86
  1454.                                                         SYSTEM: KC-TPEGA
  1455.  
  1456.  
  1457.  
  1458.         NAME:
  1459.  
  1460.                 GPFILL -- Fill the specified area with color/shading
  1461.  
  1462.         SYNOPSIS:
  1463.  
  1464.                 P: procedure GPFILL(Border_Color: Integer);
  1465.  
  1466.                 C: void GPFILL(Border_Color)
  1467.                      unsigned integer Border_Color;
  1468.  
  1469.         DESCRIPTION:
  1470.  
  1471.                 Fill in an area starting at the CP to the border given.
  1472.             The current color or current shading will be used depending
  1473.             on the setting of the GDS_FLG variable.  The routine is for
  1474.             simple areas only, which makes it much faster than GPFLOOD.
  1475.             If the area is too complex for GPFILL, parts of the area will
  1476.             not be filled in (but it will work).  GPFILL will not fill
  1477.             pass the current viewport setting.
  1478.  
  1479.         CAUTIONS:
  1480.  
  1481.             Although any dimension from 1 to 255 can be used, the current
  1482.             version of GPFILL and GPFLOOD only works correctly with shade
  1483.             of dimensions of 1,2,4 or 8 (x and y can be different).  This
  1484.             restriction will be removed in the future.
  1485.  
  1486.         EXAMPLE:
  1487.  
  1488.             C: unsigned char Shade[] =     /* Set fill shade to GBGB  */
  1489.                  {2,2,Green,Blue,Blue,Green};    /* 2 by 2 array */
  1490.  
  1491.                GPSHADE(Shade);             /* Define the shading      */
  1492.  
  1493.                GPMOVE(X1,Y1);
  1494.                GPFILL(color);              /* Flood area with border
  1495.                                               defined by color        */
  1496.  
  1497.         SEE ALSO:
  1498.  
  1499.             GPCOLOR, GPSHADE, GPFLOOD and GPVIEWPORT.
  1500.  
  1501.  
  1502.                                                         DATE:   02/03/86
  1503.                                                         SYSTEM: KC-TPEGA
  1504.  
  1505.  
  1506.  
  1507.         NAME:
  1508.  
  1509.                 GPFLOOD -- Flood the specified area with color/shading
  1510.  
  1511.         SYNOPSIS:
  1512.  
  1513.                 P: procedure GPFLOOD(Border_Color: Integer);
  1514.  
  1515.                 C: void GPFLOOD(Border_Color)
  1516.                      unsigned integer Border_Color;
  1517.  
  1518.         DESCRIPTION:
  1519.  
  1520.                 Flood in an area starting at the CP to the border given.
  1521.             The current color or current shading will be used depending
  1522.             on the setting of the GDS_FLG variable.  The routine is for
  1523.             all complex areas, which makes it much slower than GPFILL.
  1524.             If the area is simple, try GPFILL, if it does not fill it all
  1525.             then go back to GPFLOOD.  GPFLOOD will not flood pass the
  1526.             current viewport setting.
  1527.  
  1528.         CAUTIONS:
  1529.  
  1530.             Although any dimension from 1 to 255 can be used, the current
  1531.             version of GPFLOOD only works correctly with shade of
  1532.             dimensions of 1,2,4 or 8 (x and y can be different).  This
  1533.             restriction will be removed in the future.
  1534.  
  1535.         EXAMPLE:
  1536.  
  1537.             C: unsigned char Shade[] =     /* Set fill shade to GBGB  */
  1538.                  {2,2,Green,Blue,Blue,Green};    /* 2 by 2 array */
  1539.  
  1540.                GPSHADE(Shade);             /* Define the shading      */
  1541.  
  1542.                GPMOVE(X1,Y1);
  1543.                GPFLOOD(color);             /* Flood area with border
  1544.                                               defined by color        */
  1545.  
  1546.         SEE ALSO:
  1547.  
  1548.             GPCOLOR, GPSHADE, GPFILL, and GPVIEWPORT.
  1549.  
  1550.  
  1551.